package com.jic.member.impl;

import java.lang.Long;
import java.util.List;

import com.jic.common.base.vo.Page;
import com.jic.common.base.vo.PageResult;
import com.jic.member.entity.MememberLegalRuleAction;
import com.jic.member.mapper.MememberLegalRuleActionMapper;
import com.jic.member.service.MememberLegalRuleActionService;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

/**
 * 会员等级管理-权益规则-购物-积分-活动-服务-内容-等级升级表
 * @author : 
 * @email : 
 * @since : 2020-04-02 07:50:25
 * @version : v1.0.0
 */
@Service
public class MememberLegalRuleActionServiceImpl implements MememberLegalRuleActionService{

    @Autowired
    private MememberLegalRuleActionMapper mememberLegalRuleActionMapper;

    @Override
    public long insert(MememberLegalRuleAction mememberLegalRuleAction) {
        long flag = mememberLegalRuleActionMapper.insert(mememberLegalRuleAction);
        return flag;
    }

    @Override
    public long delete(Long id) {
        return mememberLegalRuleActionMapper.delete(id);
    }

    @Override
    public long update(MememberLegalRuleAction mememberLegalRuleAction) {
        return mememberLegalRuleActionMapper.update(mememberLegalRuleAction);
    }

    @Override
    public MememberLegalRuleAction queryByPrimaryKey(Long id){
        return mememberLegalRuleActionMapper.queryByPrimaryKey(id);
    }

    @Override
    public List<MememberLegalRuleAction> query(MememberLegalRuleAction mememberLegalRuleAction){
        return mememberLegalRuleActionMapper.query(mememberLegalRuleAction);
    }

    @Override
    public PageResult<MememberLegalRuleAction> queryPage(MememberLegalRuleAction mememberLegalRuleAction, Page pageQuery) {
        //计算下标
        int startIndex = (pageQuery.getStart() - 1) * pageQuery.getLimit();
        List<MememberLegalRuleAction> list = mememberLegalRuleActionMapper.queryPage(startIndex, pageQuery.getLimit(), mememberLegalRuleAction);
        long count = mememberLegalRuleActionMapper.queryPageCount(mememberLegalRuleAction);
        PageResult pageResult = new PageResult();
        pageResult.setRows(list);
        pageResult.setTotal(count);
        return pageResult;
    }
}